/*
* @Author: gavin
* @Date:   2017-12-25 13:02:46
* @Last Modified by:   gavin
* @Last Modified time: 2017-12-25 14:15:42
*/
import React from "react";
import { Table, Icon, Divider, Button, Card } from "antd";
import { observer, inject, PropTypes } from "mobx-react";
import { toJS } from "mobx";
const columns = [
  {
    title: "Title",
    dataIndex: "title",
    key: "title",
  },
  {
    title: "ID",
    dataIndex: "id",
    key: "id",
  },
  {
    title: "Time",
    dataIndex: "time",
    key: "time",
  },
  {
    title: "操作",
    key: "action",
    render: (text, record) => (
      <span>
        <a href="/home/backlogview">处理</a>
      </span>
    ),
  },
];

class BacklogView extends React.Component {
  componentWillMount() {
    if (typeof module !== "undefined" && module.exports) {
      this.props.backlog.load();
    } else if (
      this.props.backlog.asJson === undefined ||
      this.props.backlog.asJson.length == 0
    ) {
      this.props.backlog.load();
    }
  }
  render() {
    const { backlog } = this.props;
    const rowSelection = {};
    return (
      <Card>
        <Table
          rowSelection={rowSelection}
          columns={columns}
          dataSource={backlog.asJson}
          rowKey="id"
        />
      </Card>
    );
  }
}
BacklogView.propTypes = {
  backlog: PropTypes.observableObject.isRequired
};

export default inject("backlog")(observer(BacklogView));
